// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Item {
    width: 480
    height: 854

    signal closeMe()

    Rectangle {
        id: rectangle_background
        color: "#000000"
        opacity: 0.600
        anchors.fill: parent
    }

    MouseArea
    {
        anchors.fill: parent
    }

    Item {
        id: setting_container
        anchors.bottomMargin: 87
        anchors.fill: parent

        Rectangle {
            id: frame
            color: "#00000000"
            border.width: 3
            border.color: "#ffffff"
            anchors.rightMargin: 20
            anchors.leftMargin: 20
            anchors.bottomMargin: 10
            anchors.topMargin: 20
            anchors.fill: parent

            ListView {
                id: list_view_pages
                anchors.bottomMargin: 90
                anchors.fill: parent
                contentHeight: height
                contentWidth: parent.width * 2
                clip: true
                cacheBuffer: 3
                flickableDirection: Flickable.HorizontalFlick
                boundsBehavior: Flickable.StopAtBounds
                snapMode: ListView.SnapOneItem
                orientation: ListView.Horizontal
                delegate: delegate_pages
                model: 3
            }

            Component
            {
                id: delegate_pages
                Loader
                {
                    width: frame.width - 30
                    height: frame.height/* - 87*/

                    source:
                    {
                        switch (index)
                        {
                        case 0 :
                            "./SettingPage0.qml";
                            break;
                        case 1 :
                            "./CityChooser.qml";
                            break;
                        case 2 :
                            "./SettingPage1.qml";
                            break;
                        }
                    }
                }
            }

            Mbutton {
                id: mbutton1
                textstring: "关闭"
                pro_height: 70
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 10
                anchors.horizontalCenter: parent.horizontalCenter

                onButtonclick:
                {
                    closeMe();
                }
            }
        }
    }


    ////////////////////////////////////////////////////////////
    Loader
    {
        id: loader_input_gps
        source: ""

        function set_loader(title)
        {
            loader_input_gps.source = "MTextInput.qml";
            loader_input_gps.item.title_text = title;
        }
    }

    Connections
    {
        id: con_input_gps
        target: loader_input_gps.item

        onConfirm:
        {
            var input = "" + inputtext;
            loader_input_gps.source = "";
            var num = Number(input);
            if (num < 99 && num > 1)
            {
                data_container.setting_gps_update_interval = num;
            }
            else
            {
                root.set_notification_loader(2000, "请输入1～99之间的数字");
            }
        }

        onCancel:
        {
            loader_input_gps.source = "";
        }
    }

    ////////////////////////////////////////////////////////////
    Loader
    {
        id: loader_input_follow
        source: ""

        function set_loader(title)
        {
            loader_input_follow.source = "MTextInput.qml";
            loader_input_follow.item.title_text = title;
        }
    }

    Connections
    {
        id: con_input_follow
        target: loader_input_follow.item

        onConfirm:
        {
            var input = "" + inputtext;
            loader_input_follow.source = "";
            var num = Number(input);
            if (num < 99 && num > 1)
            {
                data_container.setting_gps_follow_interval = num;
            }
            else
            {
                root.set_notification_loader(2000, "请输入1～99之间的数字");
            }
        }

        onCancel:
        {
            loader_input_follow.source = "";
        }
    }
}
